extends Sprite2D

func _init() -> void:
	print("Hello World!")

func _ready() -> void:
	var timer = get_node("Timer")
	timer.timeout.connect(_on_timer_timeout)

func _process(delta: float) -> void:
	var d = 0
	
	if Input.is_action_pressed("ui_left"):
		d = -1
	elif Input.is_action_pressed("ui_right"):
		d = 1
	
	rotation += PI*d*delta
	
	if Input.is_action_pressed("ui_up"):
		var dir = Vector2.UP.rotated(rotation)
		position += 400*dir*delta


func _on_button_pressed() -> void:
	set_process(not is_processing())

func _on_timer_timeout():
	visible = not visible
